package com.rongc.client.freight.base.view.adapter;

import android.content.Context;
import android.view.View;

import com.bumptech.glide.Glide;
import com.rongc.client.core.utils.StringUtils;
import com.rongc.client.freight.R;

import java.util.HashMap;
import java.util.List;

/**
 * Created by ccqx on 2017/6/28.
 */

public class RecyclerAuthAdapter extends RecyclerBaseAdapter<HashMap<String,String>>{


    public RecyclerAuthAdapter(Context mContext, List<HashMap<String, String>> mDatas) {
        super(mContext, mDatas);
    }

    @Override
    protected void onBind(final BaseRecyclerViewHolder holder, int position, HashMap<String, String> data) {

        holder.setText(R.id.tv_idcard,data.get("name"));
        if(StringUtils.isEmpty(data.get("image")))    {
            holder.getImageView(R.id.iv_idcard).setVisibility(View.GONE);
        }else {
            holder.getImageView(R.id.iv_idcard).setVisibility(View.VISIBLE);
//            holder.getImageView(R.id.iv_idcard).setImageURI(Uri.fromFile(new File(data.get("image"))));
            Glide.with(mContext.getApplicationContext())
                    .load(data.get("image"))
                    .placeholder(R.mipmap.auth_icon)
                    .into(holder.getImageView(R.id.iv_idcard));

        }
    }

    @Override
    protected int getLayoutId() {
        return R.layout.recycler_auth_item;
    }
}
